package com.axjy.yycg.mapper;

import com.axjy.yycg.pojo.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * User: ZhangXuanWei
 * Time: 2018/3/20 21:05
 * Description:
 */
public interface RoleMapper {

    //查询所有角色
    @Select("select * from role")
    public List<Role> list();


    //添加角色
    @Insert("insert into role(name,modify_Time,state) values(#{name},#{modifyTime},#{state})")
    Integer addRole(Role role);

    //根据ID批量删除角色
    @Delete("delete from role where id=#{id}")
    Integer batchDel(Integer id);

    //根据ID修改角色状态
    @Update("update role set state=#{state} where id=#{id}")
    Integer updateState(@Param("id") Integer id,@Param("state") Integer state);


    //根据ID修改角色名称
    @Update("update role set name=#{name} where id=#{id}")
    Integer updateName(@Param("id") Integer id,@Param("name") String name);
}
